package NIO_AIO_Netty;

import java.io.IOException;
import java.net.Socket;

/**
 * @program: planet-company
 * @description:
 * @author: jyz
 * @create: 2019-09-19 19:20
 **/
public class ClientTest {
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("127.0.0.1",8888);
        System.out.println("地址 == "+socket.getInetAddress()+socket.getPort());
        socket.getOutputStream().write("HelloWord".getBytes());
        socket.getOutputStream().flush();

        System.out.println("write over,waiting for msg back....");
        byte[] bytes = new byte[1024];
        int len = socket.getInputStream().read(bytes);
        System.out.println(new String(bytes,0,len));
        socket.close();
    }
}
